package mx.com.matersys.vacs.web;

import mx.com.matersys.vacs.domain.Estatus;
import mx.com.matersys.vacs.domain.Familiar;
import mx.com.matersys.vacs.domain.Mensajes;
import mx.com.matersys.vacs.domain.Paciente;
import mx.com.matersys.vacs.utils.Constantes;
import mx.com.matersys.vacs.utils.JsonSerializer;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.roo.addon.web.mvc.controller.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@RooWebScaffold(path = "familiars", formBackingObject = Familiar.class)
@RequestMapping("/familiares/")
@Controller
public class FamiliarController {
	
	
	@RequestMapping(value = "/getFamiliares", method = RequestMethod.GET, headers = "Accept=application/json")
    @ResponseBody
    public ResponseEntity<java.lang.String> getDetallePaciente(@RequestParam(value = "idPaciente", required = true) Integer idPaciente) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("Content-Type", "application/json");
        headers.add("Content-Type", "application/text; charset=utf-8");
        System.out.println("idPaciente: " + idPaciente);
        String response = JsonSerializer.serialize(Familiar.findAllFamiliarsById(idPaciente), java.util.List.class);
        return new ResponseEntity<String>(response, headers, HttpStatus.OK);
    }
	
	
}
